/*
 * @Author: wang cong wangc9832@163.com
 * @Date: 2023-06-21 15:58:04
 * @LastEditors: wang cong wangc9832@163.com
 * @LastEditTime: 2024-02-04 09:15:51
 * @FilePath: /ams_kt_front/src/api/operation/amsChangeRecordLeased.ts
 * @Description:
 *
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
 */
import { BasicFetchResult } from '../model/baseModel';
import { defHttp } from '@/utils/http/axios';
import { downloadBlob } from '@/utils/file/download';
const api = '/amsContractChangeRecord';

// 变更记录_根据versionsId单条查询
export const detailByVersionId = (id?: any) =>
  defHttp.get<BasicFetchResult<any>>({
    url: api + '/detailByNewContractId/' + id,
  });
//租赁合同变更记录表_不分页列表查询
export const list = (params?: any) =>
  defHttp.get<BasicFetchResult<any>>({ url: api + '/list', params });
// 租赁合同变更记录表_导出
export const expHistory = (params?: any) => {
  return new Promise<void>((resolve, reject) => {
    defHttp
      .get(
        { responseType: 'blob', url: api + '/export', params },
        { isReturnNativeResponse: true },
      )
      .then((res) => {
        downloadBlob(res);
        resolve();
      })
      .catch(() => {
        reject();
      });
  });
};
// 租赁合同变更记录表_分页查询
export const pageHistry = (params?: any) =>
  defHttp.get<BasicFetchResult<any>>({ url: api + '/page', params });
